(bug 8461) Support watching pages on move
authorRob Church <robchurch@users.mediawiki.org>
Tue, 2 Jan 2007 23:37:56 +0000 (23:37 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Tue, 2 Jan 2007 23:37:56 +0000 (23:37 +0000)
RELEASE-NOTES
includes/SpecialMovepage.php
includes/SpecialPreferences.php
includes/User.php
languages/messages/MessagesEn.php

index 6dbf064..3134ce8 100644 (file)
@@ -452,6 +452,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Avoid PHP warning in Creative Commons metadata when a creative commons
   license is not actually set up
 * (bug 8463) Don't print external link icons for Monobook
+* (bug 8461) Support watching pages on move
 
 == Languages updated ==
 
index 6701c08..e3112c4 100644 (file)
@@ -49,6 +49,8 @@ function wfSpecialMovepage( $par = null ) {
 class MovePageForm {
        var $oldTitle, $newTitle, $reason; # Text input
        var $moveTalk, $deleteAndMove;
+       
+       private $watch = false;
 
        function MovePageForm( $par ) {
                global $wgRequest;
@@ -62,6 +64,7 @@ class MovePageForm {
                        $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true );
                }
                $this->deleteAndMove = $wgRequest->getBool( 'wpDeleteAndMove' ) && $wgRequest->getBool( 'wpConfirm' );
+               $this->watch = $wgRequest->getCheck( 'wpWatch' );
        }
 
        function showForm( $err ) {
@@ -171,6 +174,14 @@ class MovePageForm {
                        <td><label for=\"wpMovetalk\">{$movetalk}</label></td>
                </tr>" );
                }
+               
+               $watchChecked = $this->watch || $wgUser->getBoolOption( 'watchmoves' ) || $ot->userIsWatching();
+               $watch  = '<tr>';
+               $watch .= '<td align="right">' . Xml::check( 'wpWatch', $watchChecked, array( 'id' => 'watch' ) ) . '</td>';
+               $watch .= '<td>' . Xml::label( wfMsg( 'move-watch' ), 'watch' ) . '</td>';
+               $watch .= '</tr>';
+               $wgOut->addHtml( $watch );
+               
                $wgOut->addHTML( "
                {$confirm}
                <tr>
@@ -242,6 +253,15 @@ class MovePageForm {
                } else {
                        $talkmoved = 'notalkpage';
                }
+               
+               # Deal with watches
+               if( $this->watch ) {
+                       $wgUser->addWatch( $ot );
+                       $wgUser->addWatch( $nt );
+               } else {
+                       $wgUser->removeWatch( $ot );
+                       $wgUser->removeWatch( $nt );
+               }
 
                # Give back result to user.
                $titleObj = SpecialPage::getTitleFor( 'Movepage' );
index b2e24ca..ded82fb 100644 (file)
@@ -882,7 +882,7 @@ class PreferencesForm {
                $wgOut->addHtml( '<br /><br />' );
 
                $wgOut->addHtml( $this->getToggles( array( 'watchlisthideown', 'watchlisthidebots', 'watchlisthideminor' ) ) );
-               $wgOut->addHtml( $this->getToggles( array( 'watchdefault', 'watchcreations', 'watchdeletion' ) ) );
+               $wgOut->addHtml( $this->getToggles( array( 'watchdefault', 'watchcreations', 'watchmoves', 'watchdeletion' ) ) );
                
                $wgOut->addHtml( '</fieldset>' );
 
index 8f0ce27..e038066 100644 (file)
@@ -50,6 +50,7 @@ class User {
                'editwidth',
                'watchcreations',
                'watchdefault',
+               'watchmoves',
                'watchdeletion',
                'minordefault',
                'previewontop',
index ead8696..ff1852d 100644 (file)
@@ -466,6 +466,7 @@ parent class in order maintain consistency across languages.
 'tog-editwidth' => 'Edit box has full width',
 'tog-watchcreations' => 'Add pages I create to my watchlist',
 'tog-watchdefault' => 'Add pages I edit to my watchlist',
+'tog-watchmoves' => 'Add pages I move to my watchlist',
 'tog-watchdeletion' => 'Add pages I delete to my watchlist',
 'tog-minordefault' => 'Mark all edits minor by default',
 'tog-previewontop' => 'Show preview before edit box',
@@ -1953,6 +1954,7 @@ In those cases, you will have to move or merge the page manually if desired.',
 'movenologintext' => "You must be a registered user and [[Special:Userlogin|logged in]]
 to move a page.",
 'newtitle'             => 'To new title',
+'move-watch' => 'Watch this page',
 'movepagebtn'  => 'Move page',
 'pagemovedsub' => 'Move succeeded',
 'pagemovedtext' => "Page \"[[$1]]\" moved to \"[[$2]]\".",